package com.zpark;

import com.zpark.annotation.MyLoadBalanced;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
// 开启Eureka客户端
@EnableEurekaClient
public class Ribbon01Application {
    public static void main(String[] args) {
        SpringApplication.run(Ribbon01Application.class, args);
    }

    @Bean
    // 开启ribbon负载均衡功能
    @LoadBalanced
//    @MyLoadBalanced
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }

}
